home *** CD-ROM | disk | FTP | other *** search
/ Windows News 1997 February / Windows News CD #1 - Fev 97.iso / share / pbbs500 / disk2.pwr / POWROBJ.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-02-16  |  35.5 KB  |  967 lines

  1. {$M 20000, 20000}
  2. library PowrObj;
  3. { PowerBBS Development Add-On DLL }
  4. { (c) 1994 by Russell E. Frey     }
  5.  
  6. { This source code may be freely distributed. }
  7. { You may create a 3rd party DLL add-on to PowerBBS, and
  8.   distribute it ROYALTY FREE. }
  9.  
  10. { You may even modify this code and distribute it, so long as you
  11.   note the modifications at the top of the code and keep ALL the
  12.   comments here at the top.}
  13.  
  14. { Be sure to announce your product on our BBS: 516-822-7396 and/or
  15.   distribute shareware versions of your DLL on our BBS.  We will do
  16.   our best to help you distribute your product! }
  17.  
  18. { If you translate this code to a different language, please consider
  19.   making your translation FREEWARE and upload it to the BBS.  Be sure
  20.   to thoroughly debug your translation (you do not want to mess up
  21.   the users record or they will not be happy!) }
  22.  
  23. { Sample code in Borland Pascal 7.0 on writing an add-on DLL for PowerBBS }
  24.  
  25. { This code can easily be translated to ANY language capable of writing a DLL }
  26. { To run this DLL, in PowerBBS MENU SETUP at the CGM option place a D [For
  27.   DLL!].  Then in the description of command put the NAME of the actual
  28.   DLL created.  For example this file: POWRDLL.DLL would be placed in
  29.   the description.
  30.  
  31.   When a user now selects the command PowerBBS will dynamically load
  32.   POWRDLL.DLL.  It will execute VERY FAST.  This is an easy way to create
  33.   a 3rd party add-on as if it was written inside of PowerBBS!  The user
  34.   will notice NO SLOWDOWN! }
  35.  
  36. { PowerLang's RUN_DLL command may also be used to execute the DLL }
  37.  
  38. { We welcome ALL your comments on the Power of PowerBBS's DLL }
  39. { We also welcome any questions you might have, but due to time }
  40. { constraints may not be able to help you in some cases (including
  41.   debugging your code, etc). }
  42.  
  43. { Be aware that this product is provided AS IS.  We are not
  44.   liable for ANY problems this DLL may cause. }
  45.  
  46. uses
  47.   WinDos,
  48.   Strings,
  49.   WinProcs,
  50.   WinTypes;
  51.  
  52. { Need Colors?  Use the following in your Print_Modem calls:
  53.  
  54.   AFTER calling the CONVERT_MACROS procedure!
  55.  
  56.   @1@ Blue
  57.   @2@ Green
  58.   @3@ Cyan
  59.   @4@ Red
  60.   @5@ Magenta
  61.   @6@ Gray
  62.   @7@ Yellow
  63.   @8@ Brown
  64.   @9@ White
  65.   @10@ Light Blue
  66.   @11@ Light Green
  67.   @12@ Light Cyan
  68.   @13@ Light Red
  69.   @14@ Light Magenta
  70.   @15@ Light Gray
  71.   @16@ Default Color
  72.  
  73.   Colors will ONLY be used if the caller has ANSI capabilities.
  74. }
  75.  
  76. {-----------------------------------------------------------------------------}
  77. { User types to directly manipulate user information.                         }
  78. { NEVER MANIPULATE any information unless you are SURE of what you are doing! }
  79. {-----------------------------------------------------------------------------}
  80. Type
  81.    packed_2_chars  = array[1..2] of char;
  82.    packed_3_chars  = array[1..3] of char;
  83.    packed_4_chars  = array[1..4] of char;
  84.    packed_5_chars  = array[1..5] of char;
  85.    packed_6_chars  = array[1..6] of char;
  86.    packed_7_chars  = array[1..7] of char;
  87.    packed_8_chars  = array[1..8] of char;
  88.    packed_9_chars  = array[1..9] of char;
  89.    packed_10_chars = array[1..10] of char;
  90.    packed_11_chars = array[1..11] of char;
  91.    packed_12_chars = array[1..12] of char;
  92.    packed_13_chars = array[1..13] of char;
  93.    packed_14_chars = array[1..14] of char;
  94.    packed_15_chars = array[1..15] of char;
  95.    packed_16_chars = array[1..16] of char;
  96.    packed_19_chars = array[1..19] of char;
  97.    packed_20_chars = array[1..20] of char;
  98.    packed_23_chars = array[1..23] of char;
  99.    packed_24_chars = array[1..24] of char;
  100.    packed_25_chars = array[1..25] of char;
  101.    packed_30_chars = array[1..30] of char;
  102.    packed_39_chars = array[1..39] of char;
  103.    packed_40_chars = array[1..40] of char;
  104.    packed_32_chars = array[1..32] of char;
  105.    packed_35_chars = array[1..35] of char;
  106.    packed_45_chars = array[1..45] of char;
  107.    packed_78_chars = array[1..78] of char;
  108.    packed_128_chars = array[1..128] of char;
  109.  
  110.   {Specification of the PowerUser_Rec. variable which stores the current
  111.    users information.}
  112.  pPowrUser_Record = ^PowrUser_Record;
  113.   PowrUser_Record = record
  114.          name:                packed_25_chars;    {Name}
  115.          Location:            packed_20_chars;    {City/Location}
  116.          Computer:            packed_15_chars;    {Computer Type}
  117.          Phone_Number:        packed_14_chars;    {Phone Number} {Home}
  118.          Password:            packed_10_chars;    {Password}
  119.          Birthday:            packed_8_chars;     {Date of birthday, DD/MM/YY}
  120.          First_Call:          packed_8_chars;     {Date of first call, DD/MM/YY}
  121.          Last_File_Scan:      packed_8_chars;     {Date of last file search, DD/MM/YY}
  122.          Expiration_Date:     packed_8_chars;     {Expiration Date}
  123.          Last_Call:           packed_8_chars;     {Date of last call, DD/MM/YY}
  124.          Last_Time:           packed_5_chars;     {Time of last call, HH:MM}
  125.          Calls:               integer;    {Total number of calls}
  126.          uploads:             integer;    {Total number of uploads}
  127.          downloads:           integer;    {Total number of downloads}
  128.          Time_On:             integer;    {Minutes used TODAY}
  129.          Today_Bytes:         double;     {Bytes downloaded TODAY}
  130.          Download_Bytes:      double;     {Total bytes downloaded}
  131.          Upload_Bytes:        double;     {Total bytes uploaded}
  132.          JUNK:                array[1..820] of byte;
  133.          Qwk_Init:            byte;
  134.          QWK_Flag1,
  135.          QWK_Flag2:           byte;
  136.          QWK_Flag3,
  137.          QWK_Flag4:           word;
  138.          internaluse:         byte;
  139.          waiting_messages:    word; { number of messages waiting }
  140.          reservedb:           byte;
  141.          reservedl:           longint;
  142.          handle_new:           byte;
  143.          info_in_new_numbs:    byte; {if<>200 then just junk in next fields:}
  144.          chat_use_handle:      boolean;
  145.          qwk_msg_use_handle:   boolean;
  146.          data_phone:           packed_14_chars;
  147.          business_number:      packed_14_chars;
  148.          fax_number:           packed_14_chars;
  149.  
  150.          bchat_exit:           Byte; {if=200 use string}
  151.          chat_exit:           String[60];
  152.          bchat_entry:          Byte; {if=200 use string}
  153.          chat_entry:          String[60];
  154.          Access:              Byte;       {Access Level}
  155.          Expiration_Access:   Byte;       {Expired Access Level}
  156.          Screen_Lines:        Byte;       {Length of a page}
  157.          Safe_Total:          Byte;       {Time in Bank}
  158.          Options:             byte;       {Option bits}
  159.           {bit value 1 = expert; 4 = dead; 8 = hasmail; 16=TRUE,64=TRUE then 32=TRUE[MALE];FALSE[FEMALE]}
  160.          Xproto:              Char;       {Protocol}
  161.          Monitor_Type:        Char;       {Monitor? (M)onocrome (C)olor (N)one}
  162.          Messages_Left:       word;       {total messages left by user}
  163.          downbytes_month:     double;           {total bytes downloaded/month}
  164.          downbytesmonth:      byte;
  165.          downbytes_month_max: word;             {max downbytes/month}
  166.          truebps2:            packed_5_chars;   {true baud rate}
  167.          lang_num:            byte;             {current language number}
  168.          is_focused:          boolean;              {used internally}
  169.          powercomm_connect:   boolean;              {true if PowerComm
  170.                                                      connect}
  171.          color_mode_connect:  boolean;              {true if PowerComm/
  172.                                                      color_mode connect}
  173.          last_forum_on2:      byte;                 {last forum joined}
  174.          credits:             longint;              {amount of credits left}
  175.          anony_name2:         string[15];           {JUNK}
  176.          script:              array[1..37] of char; {used for scripts}
  177.          auto_forum_join_set: char; { = 10 means use auto forum join! }
  178.          auto_forum_join:     integer;
  179.          set_up_int_msgs:     byte;   { = 10 if use next two options! }
  180.          max_internet_msgs_month: word;
  181.          current_internet_msgs_month: word;
  182.          the_internet_month: byte;
  183.  
  184.          allow_FTPmail:       byte;   {allow if = 10}
  185.          dollars:             word;
  186.          call_verified:       byte;
  187.          anonymous_name:      array[1..20] of char;
  188.          has_anonyname:       char; { if true, set to 10 }
  189.          has_address:         char; { if true, set to 10 }
  190.          last_menu_code:      byte;
  191.          QWK_Net_User:        byte; { if true, set to 10 }
  192.          area_backnum:        array[1..3] of char;
  193.          last_forum_on:       integer;
  194.          created_rec:         char; { if true, set to 10 }
  195.          PowerUser_Ext_Num:   word;
  196.  
  197.          address:             array[1..50] of char; {address} {location above}
  198.          state:               array[1..10] of char;  {state}
  199.          zip:                 array[1..10] of char; {zip}
  200.  
  201.          call_backnum:        array[1..7] of char;  {Called Number}
  202.        end;
  203.  
  204.   { The following record holds the forum information (all 1000 forums) }
  205. const
  206.   highest_ext_forum_number = 999; { was 1000 }
  207.  
  208. type
  209.    { data structure for PowerUser_Rec.Forum }
  210.    forum_data_options_record = record
  211.       Options:    byte;            {Options}
  212.         {bit value 1 = member
  213.                    2 = 2
  214.              16= join_it}
  215.       Message_Pointer: single;     {Pointer to message last read}
  216.    end;
  217.  
  218.   Array_Of_Forum_Ext = array[0..highest_ext_forum_number] of forum_data_options_record;
  219.  
  220.  pPowrUser_Record_Extension = ^PowrUser_Record_Extension;
  221.   PowrUser_Record_Extension = record
  222.     Delete_This:  boolean;
  223.     Forum_Data:   Array_Of_Forum_Ext;       {0..999}
  224.     user_name:    longint;    { 32 bit CRC of user name }
  225.     junk:         byte;
  226.   end;
  227.  
  228.   {Specification of the Power_CallInfo_Rec; holds the current caller's
  229.    information (The USERINFO.BBS File) }
  230.  pPower_CallInfo_Rec = ^Power_CallInfo_Rec;
  231.   Power_CallInfo_Rec = record
  232.     name:             packed_25_chars;         {User Name}
  233.     User_Pointer:     integer;        {User Record # starting at 1}
  234.     BaudRate:         packed_5_chars;          {Baud Rate to Send at}
  235.     Com_Number:       char;           {Com Number to Send at}
  236.     What_Menu:        byte;           {Current Menu}
  237.     color_mode:         char;           {Gcolor_modeType:
  238.                                         'C' => Color
  239.                                         'M' => Monochrome
  240.                                         'N' => None}
  241.     Access:           byte;           {User Access Level}
  242.     ForumNum2:         byte;          {Current Forum Number}
  243.     Logon_Time:       packed_5_chars;          {hh:mm Time of Logon}
  244.     Logon_Mins:       integer;        {Time the user logged on in mins}
  245.     Used_Today:       integer;        {Time the user used in
  246.                                         previous calls so far today}
  247.     time_limit:       integer;        {Maximum mins permitted on BBS}
  248.     KDownload_Maximum:integer;        {Maximum download bytes in K}
  249.     Upload_Credit:    integer;        {Minutes given for Uploading}
  250.     Minutes_Useable:  integer;        {Maximum time left for Caller}
  251.     Node_Num:         byte;           {Node number of this CallInfo File}
  252.     Path_Data:        String[28];     {Path to PowrBBS.DAT}
  253.     Forum_Num:        integer;
  254.     Whatsdoing2:      char;           {'P' - Live Program
  255.                                        'G' - Goodbye after transfer
  256.                                        'T' - Transfer}
  257.     Trans_Type:       char;           {set to U for upload or D for download}
  258.     Protocol:         byte;           {protocol # for transfers}
  259.     Started:          longint;        {transfer, 'P' - Live Program}
  260.   end;
  261.  
  262.    { structure of the forum setup }
  263.   pPowerBBS_Forum_Structure = ^PowerBBS_Forum_Structure;
  264.    PowerBBS_Forum_Structure = record
  265.       forum_name:              string[20];          {name of forum}
  266.       forum_subsysop:          packed_23_chars;     {sub-sysop if any}
  267.       is_anonymous:            boolean;             {true if anonymous
  268.                                                      messages may be entered}
  269.       all_messages_public:     boolean;             {true if no private mail}
  270.       forum_public:            boolean;             {true if open to all users}
  271.       forum_min_access_level:  integer;             {min access needed for
  272.                                                      forum no matter what}
  273.       forum_messagebase_path:  string[31];          {path/filename of message
  274.                                                      base file}
  275.       forum_newsfile:          string[31];          {path/filename to news}
  276.       forum_filelisting:       string[31];          {path/filename to listing
  277.                                                      of file areas available}
  278.       forum_filelisting_data:  string[31];          {path/filename to data
  279.                                                      file containing
  280.                                                      information as to where
  281.                                                      file lists are}
  282.       forum_download_dirs:     string[31];          {list of download
  283.                                                      directories, that one
  284.                                                      may access to download
  285.                                                      files from}
  286.       forum_upload_directory:  string[31];          {upload directory}
  287.       forum_upload_listing:    string[31];          {listing of uploaded
  288.                                                      files}
  289.    end;
  290.  
  291.  { MOST of the information located in the PowrBBS.Dat file }
  292.  { Note that MANY variables contained in this record may contain JUNK
  293.    or is part of something else used in PowerBBS.Dat.  Be careful
  294.    with what you use! }
  295. string30 = string[30];
  296. string55 = string[55];
  297. string90 = string[90];
  298. string100 = string[100];
  299. filename_type = string[50];
  300. pbbs_record = ^bbs_record;
  301.  bbs_record = record
  302.    BBS_Name:                        String30;
  303.    Sysop_FirstName:                 String[50];
  304.    Sysop_Last_Name:                 String[15];
  305.    end_default:                     string[4];
  306.    MAX_Obey_Ratio:                  Integer;
  307.    Min_Msgs_Ratio:                  Integer;
  308.    Min_Downfile_Ratio:              Integer;
  309.    Min_Downbyte_Ratio:              Integer;
  310.    Min_Msgs_Ratio2:                 Integer;
  311.    Min_Downfile_Ratio2:             Integer;
  312.    Min_Downbyte_Ratio2:             Integer;
  313.    New_User_Level:                  Integer;
  314.    Access_Level_Info:               String30;
  315.    Download_Restrict_File:          String30;
  316.    Upload_Access_File:              String30;
  317.    Users_Path:                      String30;
  318.    Users_Path2:                     String30;
  319.    Forum_Data_File:                 String30;
  320.    Protocolinfo_file:               String30;
  321.    Transfer_FileList_File:          String30;
  322.    Security_File:                   String30;
  323.    Transfer_Directory:              filename_type;
  324.    Activity_Log:                    String30;
  325.    Tranlog_Path:                    String30;
  326.    Opening:                         String30;
  327.    Hello:                           String30;
  328.    Birthday_File:                   String30;
  329.    Expired_File:                    String30;
  330.    Sysop_File:                      String30;
  331.    Forum_Menu:                      String30;
  332.    NewUser_Text:                    String30;
  333.    No_Sysop_Chat:                   String30;
  334.    enter_chat_file:                 String30;
  335.    exit_chat_File:                  String30;
  336.    Script_Text,QScript_File :        String30;
  337.    BadUsers_Names:                  String30;
  338.    Read_Help_File:                  String30;
  339.    Mail_Prefix:                     String[8];
  340.    Most_Msgs_Downloadable:          Integer;
  341.    OS_Shell_File:                   String30;
  342.    Begin_Download_File:             String30;
  343.    Begin_Upload_File:               String30;
  344.    Freefile_List:                   String30;
  345.    Start_Batch:                     String30;
  346.    Init_Modem_Command1,
  347.    Init_Modem_Command2:             String55;
  348.    Nodes_Users_Info:                String30;
  349.    chatstatfile:                    string30;
  350.    chattalkfile:                    string30;
  351.    onetoonefile:                    string30;
  352.    roominfofile:                    string30;
  353.    run_xmodem1k:                    string;
  354.    script_for_newusers:             string30;
  355.    answer_to_script:                string30;
  356.    credit_system:                   boolean;
  357.    more_credits:                    string30;
  358.    anony_info:                      string30;
  359.    runanonybbs:                     boolean;
  360.    lowbaudinfoscreen:               string30;
  361.    minimum_sec_to_abort_intro:      integer;
  362.    screen_enter_script_mode:        string30;
  363.    screen_end_script_mode:          string30;
  364.    Live_Programs_Menu:              string30;
  365.    Live_Programs_DataFile:          string30;
  366.    Chat_Help_File:                  string30;
  367.    Most_Lines_Msg:                  integer;
  368.    minimum_baud:                    longint;
  369.    Modem_Offhook:                   string30;
  370.    Read_Mail_Menu:                  string30;
  371.    aux_addr1:                       word;
  372.    cardtype:                        word;
  373.    cardseg:                         word;
  374. (* --------------------Event Information------------------------------*)
  375.    old_active_event:                Boolean;
  376.    old_time_of_event:               String[5];
  377.    old_Wait_For_Event:              Boolean;
  378. (* --------------------- Test Files ----------------------------------*)
  379.    TestFiles:                       Boolean;
  380.    TestBatch:                       String30;
  381.    TestFile1:                       String30;
  382.    TestFile2:                       String30;
  383. (*--------------------------------------------------------------------*)
  384.    Private_Uploads_Only:            Boolean;
  385.    Private_Upload_Directory:        String30;
  386.    Private_Upload_List:             String30;
  387.    Bulletins_Menu:                  String30;
  388.    Bulletins_Data:                  String30;
  389.    Baud_Rate_Open_At:               packed_5_chars;
  390.    LockBaud:                        boolean;
  391.    ClosedBBS:                       Boolean;
  392.    Port_Number,Port_Number2:        String[6];
  393.    Port_Number3:                    array[0..6] of char;
  394.    RingAnswer:                      boolean;
  395.    Max_Pause_Time:                  Integer;
  396.    UseRealName:                     Boolean;
  397.    AllowBadChars:                   Boolean;
  398.    Permit_Ansi_Messages:            Boolean;
  399.    News_New:                        Boolean;
  400.    Turn_Off_FreeCheck:              Boolean;
  401.    Minimum_Space_Uploads:           Integer;
  402.    Default_AnsiColor:               String[4];
  403.    Default_AnsiIntensity:           String[4];
  404.    Transfer_Figure_Time:            Real;
  405.    Pack_QWK_Files:                  String30;
  406.    View_ZIP_File:                   filename_type;
  407.    Test_ZIP_File:                   filename_type;
  408.    Bad_archive:                     filename_type;
  409.    IndexPath:                       string30;
  410.    IndexRamdiskPath:                string30;
  411.    StatsScreen:                     string30;
  412.    PowerInfoPath:                   string30;
  413.    SerialNumber:                    string;
  414.    AskBirthdate:                    boolean;
  415.    NonEchoChar:                     char;
  416.    DeleteDropUploads:               boolean;
  417.    FilesRatiosScreen:               string30;
  418.    LogFileName:                     String30;
  419.    TranString:                      String30;
  420.    NSPath:                          string30;
  421.    Monitor_File:                    string30;
  422.    PermitHandles:                   boolean;
  423.    FrontDoorBatch:                  string30;
  424.    QuitBatchFile:                   string30;
  425.    TheListPath:                     string30;
  426.    UpdateScreen:                    string30;
  427.    ClockScreen:                     string30;
  428.    QuestionClosed,AnswerClosed:     string30;
  429.    LangInfoFile:                    string30;
  430.    BadRatioFile:                    string30;
  431.    Source_MNU_POW_Dir:              string30;
  432.    irq_modem:                       string30;
  433.    modem_base1:                     word;
  434.    modem_base2:                     string30;
  435.    MultiLanguage:                   boolean;
  436.    UseDtr:                          boolean;
  437.    UsePowerMail:                    boolean;
  438.    UseFrontDoor:                    boolean;
  439.    Expiration_Warning:              string30;
  440.    PNET_Tagline:                    string[60];
  441.    MODEM_ATHO:                      string30;
  442.    date_format:                     byte;   { 0 = US MM-DD-YY; 1 = DD-MM-YY }
  443.    event_data_file:                 string30;
  444.    minimum_sec_new_files:           integer;
  445.    use_fax:                         boolean;
  446.    show_whose_online:               boolean;
  447.    show_dialog_on_startup:          boolean;
  448.    doorsys_path:                    string30;
  449.    track_gender:                    boolean;
  450.    Start_Up_Minimized:              boolean;
  451.    Internet_Connection:             boolean;
  452.    PowerBase_Code:                  string30;
  453.    SysopPage_DataFile:              string30;
  454.    TheWav:                          string100;
  455.    Bytes_upload_Credit:             Word;
  456.    Bytes_Dn_Up_Credit:              Word;
  457.    Credits_To_Uploader:             Word;
  458.    Caller_ID:                       Boolean;
  459.    Show_Stats:                      Boolean;
  460.    Minimum_Access_For_Internet:     Integer;
  461.    forum_network_file:              string30;
  462.    cbv_onoff,
  463.    blts_onoff:                      boolean;
  464.  
  465.    Caller_ID_Name:                  string100;
  466.    Caller_ID_Phone:                 string100;
  467.  
  468.    areacodefile: string100; {CALL1}
  469.    callbackfile: string100; {CALL2}
  470.    begincallback:string100; {CALL3}
  471.    badnumbers:   string100; {CALL4}
  472.    security_change: string100; {CALL5}
  473.    tempo: string;
  474.    Start_PowerBBS_Directory: string100;
  475.    lastdirl: string90;
  476.  
  477.    QWK_Blts,
  478.    QWK_NewFiles,
  479.    QWK_UpNewFiles,
  480.    QWK_ALLNewFiles,
  481.    QWK_GOODBYE,
  482.    QWK_NEWS,
  483.    QWK_WELCOME,
  484.    QWK_FileEnclos,
  485.    QWK_ALLFileEnclos,
  486.    QWK_PromptFileEnclos,
  487.    QWK_Logoff:            boolean;
  488.    QWK_MaxConf,
  489.    QWK_Max_QWK:           word;
  490.  
  491.    marked_mail:           string;
  492.    credit_name:           string30;
  493.    credit_bytes:          string30;
  494.  
  495.    temps1, temps2, temps3, temps4: string;
  496.    temps5:                         string;
  497.   end;
  498.  
  499. {-----------------------------------------------------------------------------}
  500. { Just conversions.  itoa and atoi in C.                                      }
  501. {-----------------------------------------------------------------------------}
  502. function int_to_asc (int: integer): string;
  503. { Converts an integer to string }
  504. var
  505.    tstr: string;
  506. begin
  507.    str(int, tstr);
  508.    int_to_asc := tstr;
  509. end;
  510.  
  511. function asc_to_int (InString:  String): integer;
  512. var
  513.    i:             integer;
  514.    value:         integer;
  515.    num:           String;
  516.  
  517. begin
  518.    num := '';
  519.    for i := 1 to length(InString) do
  520.       if (InString[i] >= '0') and (InString[i] <= '9') then
  521.          num := num + InString[i];
  522.  
  523.    if length(num) = 0 then
  524.       value := 0
  525.    else
  526.       val(num, value, i);
  527.  
  528.    asc_to_int := value;
  529. end;
  530.  
  531. function long_to_asc (int: longint): string;
  532. var
  533.    tstr: string;
  534. begin
  535.    str(int, tstr);
  536.    long_to_asc := tstr;
  537. end;
  538.  
  539.  
  540. {-----------------------------------------------------------------------------}
  541. procedure Send_Modem_Command(PBBSWIN: HWND;
  542.                              commands:string);
  543. { Sends commands to the modem and does NOT print commands on the local
  544.   screen. }
  545. var
  546.   PIn: array[0..254] of char;
  547.  
  548.  
  549. begin
  550.   StrPcopy(PIn, commands);
  551.   SendMessage(PBBSWIN, WM_COMMAND, 10012, longint(@PIn));
  552. end;
  553.  
  554.  
  555. {-----------------------------------------------------------------------------}
  556. function No_User_Online(PBBSWIN: HWND): boolean;
  557. {        **************
  558.   This is an IMPORTANT function.  If this boolean is ever TRUE it should
  559.   be the end of your DLL!  So this NEEDS to be included in all loops,
  560.   repeats, etc.  If TRUE, then exit the loop, etc..  Example:
  561.     Repeat
  562.     Until (..) or (No_User_Online);
  563. }
  564. var
  565.   pIn: Array[0..5] of char;
  566.  
  567. begin
  568.   SendMessage(PBBSWIN, WM_COMMAND, 10013, longint(@pIn));
  569.   No_User_Online := (pIn[0] = 'Y');
  570. end;
  571.  
  572. {-----------------------------------------------------------------------------}
  573. procedure Execute_Prog(PBBSWIN: HWND;
  574.                        commands:string);
  575. {
  576.   Closes the com port.  Executes commands, re-opens, and returns.
  577. }
  578.  
  579. var
  580.   PIn: array[0..254] of char;
  581.  
  582.  
  583. begin
  584.   StrPcopy(PIn, commands);
  585.   SendMessage(PBBSWIN, WM_COMMAND, 10014, longint(@PIn));
  586. end;
  587.  
  588. {-----------------------------------------------------------------------------}
  589. function Time_Left(PBBSWIN: HWND): integer;
  590. { Returns the time that the user has left }
  591. var
  592.   pIn: Array[0..254] of char;
  593.  
  594. begin
  595.   SendMessage(PBBSWIN, WM_COMMAND, 10016, longint(@pIn));
  596.   Time_Left := asc_to_int(StrPas(pIn));
  597. end;
  598.  
  599. {-----------------------------------------------------------------------------}
  600. Procedure Write_ActLog(PBBSWIN: HWND;
  601.                        ToWrite: String);
  602. { Writes TOWRITE to the activity Log }
  603. var
  604.   pIn: Array[0..254] of char;
  605.  
  606. begin
  607.   StrPcopy(pIn, ToWrite);
  608.   SendMessage(PBBSWIN, WM_COMMAND, 10019, longint(@pIn));
  609. end;
  610.  
  611. {-----------------------------------------------------------------------------}
  612. Procedure Convert_MACROS(PBBSWIN: HWND;
  613.                          Var ToConv:  String);
  614. { Converts all |MACROS| }
  615. var
  616.   pIn: Array[0..254] of char;
  617.  
  618. begin
  619.   StrPcopy(pIn, ToConv);
  620.   SendMessage(PBBSWIN, WM_COMMAND, 10020, longint(@pIn));
  621.   ToConv := StrPas(pIn);
  622. end;
  623.  
  624.  
  625. {-----------------------------------------------------------------------------}
  626. Procedure Change_Forum(PBBSWIN: HWND;
  627.                        InI:     Integer);
  628. { Change to Forum InI }
  629. var
  630.   pIn: Array[0..254] of char;
  631.  
  632. begin
  633.   StrPcopy(pIn, int_to_asc(InI));
  634.   SendMessage(PBBSWIN, WM_COMMAND, 10021, longint(@pIn));
  635. end;
  636.  
  637. {-----------------------------------------------------------------------------}
  638. Procedure Get_UserRec(PBBSWIN:  HWND;
  639.                       var user: pPowrUser_Record);
  640. {
  641.   Gives you the pointer to the actual location of the user record in memory.
  642.   By changing the actual information in this record you are able to change
  643.   the current user information!  (BE CAREFUL ON WHAT YOU DO!)
  644. }
  645. var
  646.   pIn: array[0..254] of char;
  647.    pc: pchar;
  648.    pl: array[0..3] of byte absolute pc;
  649.  
  650. begin
  651.   SendMessage(PBBSWIN, WM_COMMAND, 10030, longint(@pIn));
  652.   pl[0] := byte(pIn[0]);
  653.   pl[1] := byte(pIn[1]);
  654.   pl[2] := byte(pIn[2]);
  655.   pl[3] := byte(pIn[3]);
  656.   user := pPowrUser_Record(pc);
  657. end;
  658.  
  659. {-----------------------------------------------------------------------------}
  660. Procedure Get_ForumUserRec(PBBSWIN:  HWND;
  661.                            var fuser:pPowrUser_Record_Extension);
  662. {
  663.   Gives you the pointer to the actual location of the user forum record in
  664.   memory.  This record contains the user's last read pointers along with
  665.   the information containing which forums the user has access to.
  666. }
  667. var
  668.   pIn: array[0..254] of char;
  669.    pc: pchar;
  670.    pl: array[0..3] of byte absolute pc;
  671.  
  672. begin
  673.   SendMessage(PBBSWIN, WM_COMMAND, 10031, longint(@pIn));
  674.   pl[0] := byte(pIn[0]);
  675.   pl[1] := byte(pIn[1]);
  676.   pl[2] := byte(pIn[2]);
  677.   pl[3] := byte(pIn[3]);
  678.   fuser := pPowrUser_Record_Extension(pc);
  679. end;
  680.  
  681. {-----------------------------------------------------------------------------}
  682. Procedure Get_CallInfo(PBBSWIN:  HWND;
  683.                        var cuser:pPower_CallInfo_Rec);
  684. var
  685.   pIn: array[0..254] of char;
  686.    pc: pchar;
  687.    pl: array[0..3] of byte absolute pc;
  688.  
  689. begin
  690.   SendMessage(PBBSWIN, WM_COMMAND, 10032, longint(@pIn));
  691.   pl[0] := byte(pIn[0]);
  692.   pl[1] := byte(pIn[1]);
  693.   pl[2] := byte(pIn[2]);
  694.   pl[3] := byte(pIn[3]);
  695.   cuser := pPower_CallInfo_Rec(pc);
  696. end;
  697.  
  698.  
  699. {-----------------------------------------------------------------------------}
  700. Procedure Get_Current_ForumInfo(PBBSWIN:  HWND;
  701.                                 var forum:pPowerBBS_Forum_Structure);
  702. var
  703.   pIn: array[0..254] of char;
  704.    pc: pchar;
  705.    pl: array[0..3] of byte absolute pc;
  706.  
  707. begin
  708.   SendMessage(PBBSWIN, WM_COMMAND, 10033, longint(@pIn));
  709.   pl[0] := byte(pIn[0]);
  710.   pl[1] := byte(pIn[1]);
  711.   pl[2] := byte(pIn[2]);
  712.   pl[3] := byte(pIn[3]);
  713.   forum := pPowerBBS_Forum_Structure(pc);
  714. end;
  715.  
  716. {-----------------------------------------------------------------------------}
  717. Procedure Get_BBS_Record(PBBSWIN:  HWND;
  718.                         var bbs:   pBBS_Record);
  719. var
  720.   pIn: array[0..254] of char;
  721.    pc: pchar;
  722.    pl: array[0..3] of byte absolute pc;
  723.  
  724. begin
  725.   SendMessage(PBBSWIN, WM_COMMAND, 10034, longint(@pIn));
  726.   pl[0] := byte(pIn[0]);
  727.   pl[1] := byte(pIn[1]);
  728.   pl[2] := byte(pIn[2]);
  729.   pl[3] := byte(pIn[3]);
  730.   bbs := pBBS_Record(pc);
  731. end;
  732.  
  733. {-----------------------------------------------------------------------------}
  734. Function Search_UserName(PBBSWIN: HWND;
  735.                          TheName: String): Integer;
  736.  
  737. { Searches the UserDatabase for TheName.  If not found, returns 0.
  738.   If found, returns the record number that TheName is contained within. }
  739.  
  740. var
  741.   PIn: array[0..254] of char;
  742.  
  743. begin
  744.   strPcopy(PIn, TheName);
  745.   SendMessage(PBBSWIN, WM_COMMAND, 10040, longint(@pIn));
  746.   Search_UserName := asc_to_int(StrPas(pIn));
  747. end;
  748.  
  749. {-----------------------------------------------------------------------------}
  750. Procedure Load_UserRec(PBBSWIN:  HWND;
  751.                        var user: pPowrUser_Record;
  752.                        usernum:  integer);
  753. {
  754.   You must allocate memory for user before calling this routine!
  755.   UserNum signifies the actual user record number (ask returned
  756.   by Search_UserName)
  757. }
  758. var
  759.   pIn: array[0..254] of char;
  760.  
  761. begin
  762.   strPcopy(pIn, int_to_asc(usernum));
  763.   SendMessage(PBBSWIN, WM_COMMAND, 10041, longint(@pIn));
  764.   SendMessage(PBBSWIN, WM_COMMAND, 10042, longint(@(user^)));
  765. end;
  766.  
  767.  
  768. {-----------------------------------------------------------------------------}
  769. Procedure Save_UserRec(PBBSWIN:  HWND;
  770.                        var user: pPowrUser_Record;
  771.                        usernum:  integer);
  772. {
  773.   You must allocate memory for user before calling this routine!
  774.   UserNum signifies the actual user record number (ask returned
  775.   by Search_UserName)
  776. }
  777. var
  778.   pIn: array[0..254] of char;
  779.  
  780. begin
  781.   strPcopy(pIn, int_to_asc(usernum));
  782.   SendMessage(PBBSWIN, WM_COMMAND, 10041, longint(@pIn));
  783.   SendMessage(PBBSWIN, WM_COMMAND, 10043, longint(@(user^)));
  784. end;
  785.  
  786. {-----------------------------------------------------------------------------}
  787. Procedure Close_ComPort(PBBSWIN: HWND);
  788. { Closes the com port. }
  789.  
  790. begin
  791.   SendMessage(PBBSWIN, WM_COMMAND, 10044, 0);
  792. end;
  793.  
  794. {-----------------------------------------------------------------------------}
  795. Procedure Open_ComPort(PBBSWIN: HWND);
  796. { Opens up the Com Port. }
  797.  
  798. begin
  799.   SendMessage(PBBSWIN, WM_COMMAND, 10045, 0);
  800. end;
  801.  
  802. {-----------------------------------------------------------------------------}
  803. Procedure HangUp_Caller(PBBSWIN: HWND);
  804. { Attempts to hangup the caller.
  805.   (Note that after 4 tries it gives up, if the caller is still on-line) }
  806.  
  807. begin
  808.   SendMessage(PBBSWIN, WM_COMMAND, 10046, 0);
  809. end;
  810.  
  811. {-----------------------------------------------------------------------------}
  812. Function Number_Users_Online(PBBSWIN: HWND): integer;
  813. { Returns the number of users currently on-line. }
  814. { Only returns NON-ZERO nodes (So if a sysop has a BBS with a node 0 that
  815.   node is not counted. }
  816. var
  817.   PIn: array[0..30] of char;
  818.  
  819. begin
  820.   SendMessage(PBBSWIN, WM_COMMAND, 10047, longint(@PIn));
  821.   Number_Users_Online := asc_to_int(StrPas(PIn));
  822. end;
  823.  
  824. {-----------------------------------------------------------------------------}
  825. {
  826.   In order to send a message first call Init_Message with the header.
  827.   Then call Message_Line TOTAL_LINES Number of times.  Each with the
  828.   actual line of text for the message.
  829.   Then call Save_Message.
  830. }
  831. Procedure Init_Message(PBBSWIN:     HWND;
  832.                        From:        String90;  { Person Sending Message  }
  833.                        Tou:         String90;  { Message destination     }
  834.                        Topic:       String90;  { Subject of message      }
  835.                        Total_Lines: Integer;   { Total lines in message  }
  836.                        Forum_Num:   Integer;   { Forum number to save in }
  837.                        Private:     Boolean);  { TRUE = Private message  }
  838. var
  839.   Pin: array[0..254] of char;
  840.  
  841. begin
  842.   strPcopy(PIn, From+'~'+Tou+'~'+Topic+'~'+int_to_asc(Total_Lines)+'~'+
  843.            int_to_asc(forum_num));
  844.   if Private then
  845.     strcat(PIn, '~Y')
  846.   else
  847.     strcat(PIn, '~N');
  848.  
  849.   SendMessage(PBBSWIN, WM_COMMAND, 10050, longint(@PIn));
  850. end;
  851.  
  852. Procedure Message_Line(PBBSWIN:   HWND;
  853.                        TheLine:   String);
  854. var
  855.   PIn: array[0..254] of char;
  856.  
  857. begin
  858.   strPcopy(PIn, TheLine);
  859.   SendMessage(PBBSWIN, WM_COMMAND, 10051, longint(@PIn));
  860. end;
  861.  
  862. Procedure Save_Message(PBBSWIN: HWND);
  863.  
  864. begin
  865.   SendMessage(PBBSWIN, WM_COMMAND, 10052, 0);
  866. end;
  867.  
  868. {-----------------------------------------------------------------------------}
  869. Procedure Set_Node_Description(PBBSWIN: HWND;
  870.                                Doing:   String);
  871. { Sets the WHO IS ONLINE RECORD to what the user is doing.
  872.   Ex: Set_Node_Description(PBBSWIN, 'Using 3rd party door.'); }
  873. var
  874.   PIn: array[0..254] of char;
  875.  
  876. begin
  877.   StrPcopy(PIn, Doing);
  878.   SendMessage(PBBSWIN, WM_COMMAND, 10053, longint(@PIn));
  879. end;
  880.  
  881. function is_user_online(PBBSWIN:  HWND;
  882.                         thename:  string): boolean;
  883. { Checks if THENAME is currently on-line as a user.  If THENAME is on-line
  884.   returns TRUE }
  885. var
  886.   pIn: Array[0..254] of char;
  887.  
  888. begin
  889.   strPcopy(pIn, thename);
  890.   SendMessage(PBBSWIN, WM_COMMAND, 10054, longint(@PIn));
  891.   Is_User_Online := (pIn[0] = 'Y');
  892. end;
  893.  
  894. (************** NEW GUI PROCEDURES FOLLOW *************************)
  895.  
  896. procedure Send_Frame(PBBSWIN: HWND;
  897.                      command: longint;
  898.                      data:    string);
  899. var
  900.   ToSend: array[0..255] of Char;
  901.  
  902. begin
  903.   strPcopy(ToSend, long_to_asc(command)+';'+data);
  904.   SendMessage(PBBSWIN, wm_command, 10080, longint(@ToSend));
  905. end;
  906.  
  907. procedure PowerProt_SendFile(PBBSWIN: HWND;
  908.                              data:    string);
  909. var
  910.   ToSend: pChar;
  911.  
  912. begin
  913.   getmem(ToSend, 255);
  914.   strPcopy(ToSend, data);
  915.   SendMessage(PBBSWIN, wm_command, 10081, longint(ToSend));
  916.   freemem(ToSend, 255);
  917. end;
  918.  
  919. procedure End_DLL(PBBSWIN: HWND;
  920.                   data:    string);
  921.  
  922. begin
  923.   PostMessage(PBBSWIN, wm_command, 10082, asc_to_int(data));
  924. end;
  925.  
  926. procedure PowerBBS_DLLGUI(PBBSWIN: hWnd;
  927.                           low_frame_number,
  928.                           high_frame_number:  plongint;
  929.                           DLL_Value:  integer);  Export;
  930.  
  931. begin
  932.   low_frame_number^ := 500000;
  933.   high_frame_number^ := 500002;
  934.   MessageBox(PBBSWIN,'Here in the PowrObject for PowerBBS!', 'PowerObject', mb_ok);
  935.   Send_Frame(PBBSWIN,499999, int_to_asc(DLL_Value));  {does not do anything, just for testing}
  936. end;
  937.  
  938. procedure PowerBBS_END(PbbsWin: HWND;
  939.                        DLL_Value: Integer); Export;
  940.  
  941. begin
  942. end;
  943.  
  944. procedure PowerBBS_Frame(PBBSWIN: HWND;
  945.                          framenum: longint;
  946.                          framedata: pchar;
  947.                          DLL_Value: integer); Export;
  948.  
  949. begin
  950.   if framenum =
  951.     500000 then Send_Frame(PBBSWin, 500001, int_to_asc(DLL_Value))
  952.   else
  953.   if framenum =
  954.     500001 then End_DLL(PBBSWin, int_to_asc(DLL_Value))
  955.   else
  956.   if framenum =
  957.     500002 then PowerProt_SendFile(PBBSWin, 'C:\Autoexec.bat');
  958. end;
  959.  
  960. exports
  961.   PowerBBS_DLLGui index 10,
  962.   PowerBBS_End    index 11,
  963.   PowerBBS_Frame  index 12;
  964.  
  965. begin
  966. end.
  967.